﻿@model COMCMS.Core.Article
@{
    ViewBag.title = Model.Title;
    ViewBag.keywords = Model.Keyword;
    ViewBag.description = Model.Description;
    IList<Article> alist = Article.FindAll(Article._.KId == Model.KId, Article._.Sequence.Asc(), null, 0, 0);
    int topkid = ViewBag.kind.PId > 0 ? ViewBag.kind.PId : ViewBag.kind.Id;
    //获取同级分类
    IList<ArticleCategory> sameList = ArticleCategory.FindAll(ArticleCategory._.PId == ViewBag.kind.PId, ArticleCategory._.Rank.Asc(), null, 0, 0);

}
<div class="banner normal sec-banner">
    @if (string.IsNullOrEmpty(ViewBag.kind.BannerImg))
    {
        <em style="background: url('/images/default/slide-1.jpg') center top no-repeat; background-size: 100%;"></em>
    }
    else
    {
        <em style="background: url('@ViewBag.kind.BannerImg') center top no-repeat; background-size: 100%;"></em>
    }
</div>
<div class="banner mobile sec-banner">
    @if (string.IsNullOrEmpty(ViewBag.kind.BannerImg))
    {
        <em style="background: url('/images/default/slide-1.jpg') center top no-repeat; background-size: 100%;"></em>
    }
    else
    {
        <em style="background: url('@ViewBag.kind.BannerImg') center top no-repeat; background-size: 100%;"></em>
    }
</div>

<div class="sec-nav">
    <div class="cont">
        <ul class="sec-nav-list">
            @foreach (var k in sameList)
            {
                <li class="@(k.Id == Model.KId?"sec-on":"")"><a asp-controller="Article" asp-action="Index" asp-route-id="@(k.Id)" title="@k.KindName">@k.KindName</a></li>
            }
        </ul>

        <script type="text/javascript">
            function mbSecNav() {
                var num = $('.sec-nav-list li').length;
                if (num >= 3) {
                    $('.sec-nav-list li').css({ 'width': (640 / 3 / 100) + 'rem' });
                } else if (num == 2) {
                    $('.sec-nav-list li').css({ 'width': (640 / 2 / 100) + 'rem' });
                } else if (num == 1) {
                    $('.sec-nav-list li').css({ 'width': (213 / 100) + 'rem' });
                }
            }
        </script>
    </div>
</div>
<!-- 主体内容 -->
<div class="content newsD au">
    <div class="news-bg">
        <div class="cont">
            <div class="newsD-title">
                <span>@Model.Title</span>
                <small>@Model.AddTime.ToString("yyyy-MM-dd HH:mm")</small>
            </div>
            <div class="newsD-text">
                @Html.Raw(Model.Content)
            </div>

            <!-- 上下篇 返回 -->
            <div class="newsD-bottom normal">
                @*<div class="newsD-b-left">
                    <p>
                        <span>上一篇：</span><a href="/"></a>
                    </p>
                    <p>
                        <span>下一篇：</span>已经最后一篇
                    </p>
                </div>*@
                <a  asp-controller="Article" asp-action="Index" asp-route-id="@(Model.KId)"  class="back-list">[ 返回列表 ]</a>
            </div>
        </div>
    </div>
</div>

<script>
    $(function () {
        $("#nav_@(topkid)").addClass("nav-on");
    })
</script>
